package com.wcar.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单
 * @TableName tb_order
 */
@TableName(value ="tb_order")
@Data
public class Order implements Serializable {
    /**
     * 订单id
     */
    @TableId(type = IdType.AUTO)
    private Integer orderid;

    /**
     * 门店id（关联门店表）
     */
    private Integer storeId;

    /**
     * 商品id（关联商品表）
     */
    private Integer productId;

    /**
     * 地址id （关联地址表）
     */
    private Integer addressId;
    /**
     * 订单创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date orderCreateTime;
    /**
     * 订单确定日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date orderDetermineDate;
    /**
     * 订单支付时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date orderPayTime;

    /**
     * 支付方式（1:微信支付，2:支付宝支付）
     */
    private String payType;

    /**
     * 门店名称
     */
    private String storeName;

    /**
     * 商品名称
     */
    private String productName;

    /**
     * 总票数
     */
    private Integer tcount;

    /**
     * 商品总数
     */
    private Integer productCount;

    /**
     * 商品总价
     */
    private BigDecimal productPrice;

    /**
     * 用户昵称
     */
    private String userName;

    /**
     * 用户id
     */
    private Integer userId;
    /**
     * 订单完成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date orderFinishTime;

    /**
     * 订单状态码
     */
    private Integer orderStatusCode;

    /**
     * 支付状态码
     */
    private Integer payStatusCode;
    @TableField(exist = false)
    private String orderNo;
    @TableField(exist = false)
    private UserAddress userAddress;
    @TableField(exist = false)
    private Integer totalAmount;
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
    @TableField(exist = false)
    private BigDecimal newPrice;
    @TableField(exist = false)
    private BigDecimal freight;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 订单id
     */
    public Integer getOrderid() {
        return orderid;
    }

    /**
     * 订单id
     */
    public void setOrderid(Integer orderid) {
        this.orderid = orderid;
    }

    /**
     * 门店id（关联门店表）
     */
    public Integer getStoreId() {
        return storeId;
    }

    /**
     * 门店id（关联门店表）
     */
    public void setStoreId(Integer storeId) {
        this.storeId = storeId;
    }

    /**
     * 商品id（关联商品表）
     */
    public Integer getProductId() {
        return productId;
    }

    /**
     * 商品id（关联商品表）
     */
    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    /**
     * 地址id （关联地址表）
     */
    public Integer getAddressId() {
        return addressId;
    }

    /**
     * 地址id （关联地址表）
     */
    public void setAddressId(Integer addressId) {
        this.addressId = addressId;
    }

    /**
     * 订单创建时间
     */
    public Date getOrderCreateTime() {
        return orderCreateTime;
    }

    /**
     * 订单创建时间
     */
    public void setOrderCreateTime(Date orderCreateTime) {
        this.orderCreateTime = orderCreateTime;
    }

    /**
     * 订单确定日期
     */
    public Date getOrderDetermineDate() {
        return orderDetermineDate;
    }

    /**
     * 订单确定日期
     */
    public void setOrderDetermineDate(Date orderDetermineDate) {
        this.orderDetermineDate = orderDetermineDate;
    }

    /**
     * 订单支付时间
     */
    public Date getOrderPayTime() {
        return orderPayTime;
    }

    /**
     * 订单支付时间
     */
    public void setOrderPayTime(Date orderPayTime) {
        this.orderPayTime = orderPayTime;
    }

    /**
     * 支付方式（1:微信支付，2:支付宝支付）
     */
    public String getPayType() {
        return payType;
    }

    /**
     * 支付方式（1:微信支付，2:支付宝支付）
     */
    public void setPayType(String payType) {
        this.payType = payType;
    }

    /**
     * 门店名称
     */
    public String getStoreName() {
        return storeName;
    }

    /**
     * 门店名称
     */
    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    /**
     * 商品名称
     */
    public String getProductName() {
        return productName;
    }

    /**
     * 商品名称
     */
    public void setProductName(String productName) {
        this.productName = productName;
    }

    /**
     * 总票数
     */
    public Integer getTcount() {
        return tcount;
    }

    /**
     * 总票数
     */
    public void setTcount(Integer tcount) {
        this.tcount = tcount;
    }

    /**
     * 商品总数
     */
    public Integer getProductCount() {
        return productCount;
    }

    /**
     * 商品总数
     */
    public void setProductCount(Integer productCount) {
        this.productCount = productCount;
    }

    /**
     * 商品总价
     */
    public BigDecimal getProductPrice() {
        return productPrice;
    }

    /**
     * 商品总价
     */
    public void setProductPrice(BigDecimal productPrice) {
        this.productPrice = productPrice;
    }

    /**
     * 用户昵称
     */
    public String getUserName() {
        return userName;
    }

    /**
     * 用户昵称
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * 用户id
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 用户id
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    /**
     * 订单完成时间
     */
    public Date getOrderFinishTime() {
        return orderFinishTime;
    }

    /**
     * 订单完成时间
     */
    public void setOrderFinishTime(Date orderFinishTime) {
        this.orderFinishTime = orderFinishTime;
    }

    /**
     * 订单状态码
     */
    public Integer getOrderStatusCode() {
        return orderStatusCode;
    }

    /**
     * 订单状态码
     */
    public void setOrderStatusCode(Integer orderStatusCode) {
        this.orderStatusCode = orderStatusCode;
    }

    /**
     * 支付状态码
     */
    public Integer getPayStatusCode() {
        return payStatusCode;
    }

    /**
     * 支付状态码
     */
    public void setPayStatusCode(Integer payStatusCode) {
        this.payStatusCode = payStatusCode;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Order other = (Order) that;
        return (this.getOrderid() == null ? other.getOrderid() == null : this.getOrderid().equals(other.getOrderid()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getAddressId() == null ? other.getAddressId() == null : this.getAddressId().equals(other.getAddressId()))
            && (this.getOrderCreateTime() == null ? other.getOrderCreateTime() == null : this.getOrderCreateTime().equals(other.getOrderCreateTime()))
            && (this.getOrderDetermineDate() == null ? other.getOrderDetermineDate() == null : this.getOrderDetermineDate().equals(other.getOrderDetermineDate()))
            && (this.getOrderPayTime() == null ? other.getOrderPayTime() == null : this.getOrderPayTime().equals(other.getOrderPayTime()))
            && (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType()))
            && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
            && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
            && (this.getTcount() == null ? other.getTcount() == null : this.getTcount().equals(other.getTcount()))
            && (this.getProductCount() == null ? other.getProductCount() == null : this.getProductCount().equals(other.getProductCount()))
            && (this.getProductPrice() == null ? other.getProductPrice() == null : this.getProductPrice().equals(other.getProductPrice()))
            && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getOrderFinishTime() == null ? other.getOrderFinishTime() == null : this.getOrderFinishTime().equals(other.getOrderFinishTime()))
            && (this.getOrderStatusCode() == null ? other.getOrderStatusCode() == null : this.getOrderStatusCode().equals(other.getOrderStatusCode()))
            && (this.getPayStatusCode() == null ? other.getPayStatusCode() == null : this.getPayStatusCode().equals(other.getPayStatusCode()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getOrderid() == null) ? 0 : getOrderid().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getAddressId() == null) ? 0 : getAddressId().hashCode());
        result = prime * result + ((getOrderCreateTime() == null) ? 0 : getOrderCreateTime().hashCode());
        result = prime * result + ((getOrderDetermineDate() == null) ? 0 : getOrderDetermineDate().hashCode());
        result = prime * result + ((getOrderPayTime() == null) ? 0 : getOrderPayTime().hashCode());
        result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode());
        result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getTcount() == null) ? 0 : getTcount().hashCode());
        result = prime * result + ((getProductCount() == null) ? 0 : getProductCount().hashCode());
        result = prime * result + ((getProductPrice() == null) ? 0 : getProductPrice().hashCode());
        result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getOrderFinishTime() == null) ? 0 : getOrderFinishTime().hashCode());
        result = prime * result + ((getOrderStatusCode() == null) ? 0 : getOrderStatusCode().hashCode());
        result = prime * result + ((getPayStatusCode() == null) ? 0 : getPayStatusCode().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", orderid=").append(orderid);
        sb.append(", storeId=").append(storeId);
        sb.append(", productId=").append(productId);
        sb.append(", addressId=").append(addressId);
        sb.append(", orderCreateTime=").append(orderCreateTime);
        sb.append(", orderDetermineDate=").append(orderDetermineDate);
        sb.append(", orderPayTime=").append(orderPayTime);
        sb.append(", payType=").append(payType);
        sb.append(", storeName=").append(storeName);
        sb.append(", productName=").append(productName);
        sb.append(", tcount=").append(tcount);
        sb.append(", productCount=").append(productCount);
        sb.append(", productPrice=").append(productPrice);
        sb.append(", userName=").append(userName);
        sb.append(", userId=").append(userId);
        sb.append(", orderFinishTime=").append(orderFinishTime);
        sb.append(", orderStatusCode=").append(orderStatusCode);
        sb.append(", payStatusCode=").append(payStatusCode);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}